Repository navigation
Live tests for the Python and asyncio docs code samples - #241
Open
techwritermat wants to merge 4 commits into
Open
techwritermat wants to merge 4 commits into
techwritermat wants to merge 4 commits into
Conversation
The "Cancel workflow runs for commit on error" step (fast-jobs-failure) cancels every workflow of the commit when one fast job fails, so an unrelated failure cancelled the first attempt of other workflows. The JavaScript SDK removed the same step in PR 539. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds docs-snippets/, a pytest suite that runs the code samples of the Python and asyncio docs against the real PubNub service and asserts the documented effect. The docs embed the snippet regions with EmbeddedCode. * 311 snippet ids in 193 steps (sync and asyncio), roles open and pam * assertions sit outside the snippet markers, a marker lint enforces it * honesty checks: each step must reach snippet.end and make an assertion * run-suffixed names per step, key and token redaction, janitor, no skips * coverage.json manifest with a --check mode * separate workflow: dry job on Python 3.9 to 3.13, live shards in series under one concurrency group, nightly, fork PRs skip live * setup.py excludes docs-snippets from the package Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
techwritermat
requested review from
jguz-pubnub,
kazydek and
parfeon
as code owners
November 12, 2026 10:01
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
The staged copy under docs-snippets/.run/<id>/ cannot find the checkout from its own harness package, so pytest failed with "No module named 'pubnub'" wherever the package is not installed (the CI runner installs only the dev requirements). The run now sets PYTHONPATH to the repository root. The key status line prints only the roles the shard needs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The presence service resolves a channel group some seconds after it was created and answers 400 "No valid channels specified" until then. The read after the write now retries for up to 45 seconds with the same assertion. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
docs-snippets/, a pytest suite that runs the code samples of the Python and asyncio SDK docs against the real PubNub service and asserts the documented effect. The docs embed the snippet regions withEmbeddedCodefrom this repo (refs/heads/master/docs-snippets/...). It follows the JavaScript suite (pubnub/javascriptPRs 538 and 539).Two commits:
ci: remove the cross-workflow cancel step. Removes the fourfast-jobs-failuresteps fromrun-tests.ymlandrun-validations.yml. One failing fast job cancelled every workflow of the commit, so the first attempt of other workflows ended cancelled.test: add live docs snippet tests. The suite, its workflow and thesetup.pyexclude.What is covered
How it stays honest
snippet.endor when it made no assertionxfail, no fixed sleeps (eventuallyfor reads after writes), subset runs are refused in CIcoverage.jsonlists every snippet id,python -m harness.cli manifest --checkfails when it is stalepython -m harness.auditlists assertions per step, one log file per step is written toreport/<shard>/steps/Latest live results (open and pam keysets)
get_message_actionsignoresendwhenstartis set (pubnub/endpoints/message_actions/get_message_actions.py:50), andPubNubSubscriptionSet.unsubscribe()leaves the channels subscribed (pubnub/models/subscription.py:162-182), each in sync and asyncio. The nightly stays red until these are fixed or the expectation changes. More SDK findings are in the follow-up message to the maintainersWorkflow
.github/workflows/docs-snippets.yml: achangesjob, adryjob (no network, Python 3.9 to 3.13), alivejob (open shard then pam shard in series under one concurrency group, Python 3.11) and agatejob to require in branch protection. Triggers: pull request, push to master, nightly, manual. Fork PRs skip the live job.Needed before the live job can run
Secrets:
SDK_DOCS_OPEN_PUBLISH_KEY,SDK_DOCS_OPEN_SUBSCRIBE_KEY,SDK_DOCS_PAM_PUBLISH_KEY,SDK_DOCS_PAM_SUBSCRIBE_KEY,SDK_DOCS_PAM_SECRET_KEY. The open keyset needs Message Persistence with Delete-From-History, Presence with a*tracking rule and legacy SDK tracking, App Context with events, Files, Mobile Push and Stream Controller with wildcard subscribe. The pam keyset needs Access Manager with token revocation. Without a GitHub Environment with required reviewers, anyone with push access can read the secrets through a pull request.Not changed
pubnub/,tests/,examples/and the version are untouched. Run it locally withcd docs-snippets && python -u -m harness.cli dry(no keys) orpython -u -m harness.cli run. Seedocs-snippets/README.md.🤖 Generated with Claude Code